package com.paginasenlanube.model;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;




@Entity
@Table(name = "design" )
 public class Design implements Serializable{
	
  public static enum BgTheme { NONE(0), PATTERN(1), UPLOAD_IMAGE(2);
  int index;

  BgTheme(int index) {
      this.index = index;
  }
  
  }
  
  private static final long serialVersionUID = 1L;
  private long id;
  private String template;
  private String colorPalette;
  private String theme;
  private BgTheme bgThemeType; 
  private Image image;
  private  boolean bgImage;
	


public Design(){
	  
  }
 
  @Id
  @GeneratedValue
  @Column(name = "id")
  public long getId() {
    return id;
  }

  public void setId(long value) {
    id = value;
  }

  @OneToOne(cascade = CascadeType.ALL)
  public Image getImage() {
    return image;
  }

  public void setImage(Image value) {
    this.image = value;
  }

public String getColorPalette() {
	return colorPalette;
}

public void setColorPalette(String colorPalette) {
	this.colorPalette = colorPalette;
}

public String getTemplate() {
	return template;
}

public void setTemplate(String template) {
	this.template = template;
}

public BgTheme getBgThemeType() {
	return bgThemeType;
}

public void setBgThemeType(BgTheme bgThemeType) {
	this.bgThemeType = bgThemeType;
}

@Transient
public boolean isBgImage() {
	if(this.image != null && !this.image.getFileName().isEmpty()){
		bgImage = true;
	}
	return bgImage;
}

public void setBgImage(boolean bgImage) {
	this.bgImage = bgImage;
}

public String getTheme() {
	return theme;
}

public void setTheme(String theme) {
	this.theme = theme;
}


}
